var player = null; 
var playerT : Transform = null;
var pPos : Vector3;
var duration : float = .0001;
var maxHeight : int;
var minHeight : int;
var randTime : int;
private var passedTime : float;
private var startTime : float;
private var startPoint : Vector3;
private var randValue : float;
var verticalSpeed = 100;  //RELALY FAST needs to be slower or the camera angles higher.
var horizontalSpeed = 30;
private var timeLeft;

var obj : GameObject = null;
var hS : animalHealth = null;

function Start(){
  hS = GetComponent("animalHealth");
  player = GameObject.Find("Player");
  playerT = player.transform;
  startPoint = transform.position;
  startTime = Time.time;
  randTime = 5;
  randValue = Random.value;
}

function Update () {
  Debug.Log(hS.GetHealth());
  if(hS.GetHealth() > 0){
    pPos = playerT.position;
    transform.LookAt(playerT);
    transform.Translate(horizontalSpeed * Vector3.forward * Time.deltaTime);
    transform.Translate(0, 0, horizontalSpeed * Time.deltaTime );
  }
}

function OnCollisionEnter(collision : Collision) {
	if (collision.gameObject.tag == "Player"){
		var otherScript = collision.gameObject.GetComponent(Health);
		print (otherScript);
		otherScript.hit();	
		Destroy(gameObject);	
	}
}

//toDo peform collision;